<?php
namespace slinks\common\dynamic;
/**
 * Static delegator dynamically creates a generic class with static methods which invoke a specific serivce methods from the Slinsk cointainer. 
 * This allows static calls to objects managed by the slinks container. 
 * 
 * @author Navid Mitchell
 *
 */
use slinks\core\DependencyInjection\ContainerInterface;

class StaticDelegator{
	
	private $className;
	
	private $resources;
	
	private $delegates = array();
	
	private $containerId; 
	
	/**
	 * Construct a new StaticDelegator.
	 * @param string $className the name of the class file that will have the static calls to service classes. 
	 * @param string $containerId the Slinks container id that all services will be looked up from. 
	 */
	function __construct($className,$containerId = 'default'){
		$this->className = $className;
		$this->containerId = $containerId;
	}
	
	
	/**
	 * Adds a static method delegate to this StaticDelegator. 
	 * 
	 * @param string $serviceId the service id of the service that should be delegated to. 
	 * @param string $methodName the name of the method that should be executed.
	 * @return a string call back that can be invoked to execute the service method statically.  
	 */
	public function addDelegate($serviceId,$methodName){
		if(!array_key_exists($serviceId, $this->delegates)){
			$this->delegates[$serviceId] = array();
		}
		$this->delegates[$serviceId][] = $methodName;
		
		return $this->className.'::'.$serviceId.'_'.$methodName.'_Static';
	}
	
	
	/**
	 * @return a string which contains the dynamically generated php. 
	 */
	public function getPhp(){
		
	}

	
	
}